package com.tencent.atk.view;

import com.tencent.atk.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class FloatView extends LinearLayout {
	private static final String memoryStr = "内存:";
	private static final String cpuStr = "CPU:";
	private static final String trafficStr = "流量:";
	private TextView trafficView;
	private TextView memoryView;
	private TextView cpuView;
	
	public FloatView(Context context) {
		super(context);
		init();
	}
	
	public FloatView(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}
	
	private void init() {
		LayoutInflater flater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = flater.inflate(R.layout.floating, this);
		trafficView = (TextView) view.findViewById(R.id.traffic);
		memoryView = (TextView) view.findViewById(R.id.memory);
		cpuView = (TextView) view.findViewById(R.id.cpu);
	}
	
	public void updateTraffic(long traffic) {
		trafficView.setText(trafficStr + traffic);
	}
	
	public void updateMemory(long memory) {
		memoryView.setText(memoryStr + memory);
	}

}
